//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

namespace Microsoft.Research.eResearch.Blackboard.Interfaces
{
    using System;

    /// <summary>
    /// Implementers of this interface provide code that allows the Blackboard to receive
    /// subscription and unsubscription information from all subscribers.  The Blackboard 
    /// will start and stop the receiver and subscribe to events that will be raised when
    /// a subscriber subscribes/unsubscribes.
    /// </summary>
    public interface INotificationSubscriptionReceiver
    {
        /// <summary>
        /// Occurs when a new subscriber requests to be notified of particular BlackboardMessages.
        /// </summary>
        event EventHandler<NotificationSubscriptionEventArgs> NotificationSubscription;

        /// <summary>
        /// Occurs when a subscriber requests to be unsubscribed from all BlackboardMessages.
        /// </summary>
        event EventHandler<NotificationUnsubscriptionEventArgs> NotificationUnsubscription;

        /// <summary>
        /// Instructs the INotificationSubscriptionReceiver to begin listening for subscription/unsubscription
        /// messages from subscribers.
        /// </summary>
        void Start();

        /// <summary>
        /// Instructs the INotificationSubscriptionReceiver to stop listening for messages
        /// from subscribers.
        /// </summary>
        void Stop();
    }
}
